Embed the coding-agent tracing daemon - #287
Open
Stephen Belanger (Qard) wants to merge 19 commits into
Open
Conversation
Contributor
|
Latest downloadable build artifacts for this PR commit
Available artifact names
|
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Stephen Belanger (Qard)
force-pushed
the
agent/bt-daemon-integration
branch
from
July 30, 2026 13:55
39bbed4 to
6780c1d
Compare
Add bt agents setup codex and bt agents setup claude. The commands use each agent's plugin manager to install the currently published Braintrust tracing plugin without configuring the unreleased embedded daemon. Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Create the shared tracing settings file when missing and allow --project to select the trace project. Existing settings, including legacy authentication fields, are preserved unchanged so current published plugins continue to work. Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Stephen Belanger (Qard)
force-pushed
the
agent/bt-daemon-integration
branch
from
July 30, 2026 15:14
3fd4543 to
9f346b6
Compare
Point bt at the daemon PR commit that restores src to main, keeping the existing published plugin runtimes independent from the daemon-capable CLI release. Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Stephen Belanger (Qard)
force-pushed
the
agent/bt-daemon-integration
branch
from
July 30, 2026 15:24
9f346b6 to
3298cdf
Compare
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
Contributor
This worked, but i had no idea which org, project, etc. it wrote to. With other commands, if this is ambiguous, we show you a selector where you pick it. Also, instead of just accepting a "project", we should accept the same destination format as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependencies
Depends on merged braintrustdata/braintrust-coding-agent-plugins#1, pinned at its squash-merge commit
bebff4e0349fd9d2ee4a8ce1eeeafafee91ac74b.That daemon PR in turn depends on braintrustdata/braintrust-sdk-rust#86, pinned at commit
d33e806bf6ab9548d37355f6a5098a971ef150aa.The plugin source cutover is intentionally deferred to stacked braintrustdata/braintrust-coding-agent-plugins#3, which must land only after this daemon is available in a released
btCLI.Summary
This embeds the shared coding-agent tracing daemon in
btunder thebt tracecommand family.bt trace setupandbt trace importare the user-facing commands. Thedaemon,hook,status, andstopsubcommands remain directly callable by plugins and operators who know their names, but are hidden from public help and usage output as implementation details.bt trace import codex <session-id>andbt trace import claude <session-id>locate and snapshot native session transcripts in the agents' standard data directories, resolve the currentbtprofile and project, and send the reconstructed historical trace through the production Braintrust sink. The source is explicit because session IDs alone do not identify their producer. Codex snapshots are streamed once, native turn IDs and compaction history replacements are retained, and large imports drain in small bounded operation batches to avoid losing later turns to bounded delivery queues without serializing a network flush for every boundary. Claude imports preserve native turn ownership when physical record order is not timestamp-monotonic and propagate Claude API-error markers into turn and LLM errors. Daemon restart recovery remains an internal WAL operation; it may idempotently resubmit rows under stable backend row IDs, but cannot create duplicate logical spans.The foreground daemon initializes structured logging at INFO by default, or DEBUG with
--verbose, and emits safe request lifecycle fields such as JSON-RPC method, request ID, event type, source, and session ID. Payloads and credentials are not logged.bt trace setup codexandbt trace setup claudeuse the coding agents' own plugin managers to add the official Braintrust marketplaces and install the currently published tracing plugins. Setup also creates the shared tracing settings when needed, enables tracing, and accepts--projectfor routing. It performs a non-destructive merge: every other setting, including legacy authentication and backend fields needed by currently published plugins, is preserved unchanged.The
bthost resolves its normal profile, OAuth, keychain, or API-key credentials for each hook invocation and transcript import, passing the resulting token, backend URLs, organization, and project to the credential-passive daemon library. Hook errors remain fail-open so tracing cannot break a Codex or Claude Code turn.The daemon is consumed from the exact Git commit of its migration PR rather than through a local path dependency. The integration is rebased on current
btmain and preserves the newer top-levelupdatecommand and command routing introduced there.CLI regression tests verify that
setupandimportare advertised bybt trace --help, while the four hidden operational commands remain directly callable. They also cover the required import source and session ID, rejection of the removed replay spelling, hook options, graceful and idempotent stop, Codex and Claude plugin-manager invocations, default and explicit project selection, and preservation of existing settings. The supersededbt daemonandbt agentspaths remain rejected.Validation
cargo fmt --checkcargo test --test clibraintrust.plugin.codexspan-origin metadata.